/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bayu.controller;

/**
 *
 * @author joep
 */
import com.bayu.services.dao.AvgStopTimeDao;
import com.bayu.services.dao.Graph2mlDao;
import com.bayu.services.entity.AvgStopTime;
import com.bayu.services.entity.Graph2ml;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/avg-disa-input.htm")
public class AvgDisaInput {
    private AvgStopTimeDao dao;

    @Autowired
    public void setDao(AvgStopTimeDao dao) {
        this.dao = dao;

    }

    @RequestMapping(method=RequestMethod.GET)
    public void displayForm(ModelMap map, String id) {
    }

    @RequestMapping(method = RequestMethod.POST)
    public String proccessForm(@ModelAttribute("AvgStopTime") AvgStopTime aStop, BindingResult result,ModelMap map,HttpServletRequest req){


        this.dao.save(aStop);
                 return "redirect:view-avg-disa-data.htm?msg=Data has been updated";
    }

}
